Vue.component("top",{
	data(){
		return {
			name :"",
			status : 0,
			uid : ""
		};
	},
	
	template:
		`
		<div class="topNav clearfix">
				<ul>
					<li v-show="status==1" id="headerLogin" class="headerLogin"
						style="display: list-item;">{{name}} |</li>
					<li v-show="status==1" class="headerLogin" style="display: list-item;"><a
					 :href="'olist.html?uid='+uid">我的订单</a>|</li>
					<li v-show="status==1" id="headerRegister" class="headerRegister"
						style="display: list-item;"><a href="index.html">退出</a>|</li>
					
					
					<li v-if="status==0" id="headerLogin" class="headerLogin"
						style="display: list-item;"><a href="login.html">登录</a>|</li>
					<li v-if="status==0" id="headerRegister" class="headerRegister"
						style="display: list-item;"><a href="reg.html">注册</a>|</li>

					<li id="headerUsername" class="headerUsername"></li>
					<li id="headerLogout" class="headerLogout"><a>[退出]</a>|</li>
					<li><a>会员中心</a> |</li>
					<li><a>购物指南</a> |</li>
					<li><a>关于我们</a></li>
				</ul>
			</div>
			`,
	created(){
		axios.get("top.s").then(res=>{
			if(res.data!=null){
				this.status = 1;
				this.name=res.data.name;
				this.uid = res.data.uid;
			}
		});
	}
});